platform:="windows"
#platform:="linux"
src-c:=../../../SqliteCode/sqlite3.c
SHELL:=cmd.exe

#create static lib
lib:./obj/sqlite3.o
	-$(shell mkdir lib)
    ifeq ($(platform),"windows")
		ar -o ./lib/libsqlite.lib -rc ./obj/sqlite3.o
    else 
        ifeq ($(platform),"linux")
			ar -o ./lib/libsqlite.a -rc ./obj/sqlite3.o
        endif
    endif
./obj/sqlite3.o:$(src-c)
	-$(shell mkdir obj)
	gcc -c $(src-c) -o ./obj/sqlite3.o


#build the test .c file 
test:./obj/test.o
	gcc ./obj/test.o -o test -L ./lib -l libsqlite

./obj/test.o:test.c
	-$(shell mkdir obj)
	gcc -c test.c -o ./obj/test.o

clean:
	-rm ./test.exe ./test.o ./test.db
    #Error is ignored in here.
	-rm -rf ./obj
	-rm -rf  ./lib